package testPureMvc.view {
	import testPureMvc.ApplicationFacade;

	import org.puremvc.as3.multicore.interfaces.IMediator;
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.patterns.mediator.Mediator;

	/**
	 * @author Admin
	 */
	public class ApplicationMediator extends Mediator implements IMediator {
		
		public static const NAME : String = "ApplicationMediator";
		
		// Constructor
		public function ApplicationMediator(viewComponent : Application)
		{
			trace("ApplicationMediator init...");
			super(NAME, viewComponent);
		}
		
		
		override public function initializeNotifier(key:String):void
		{
			super.initializeNotifier(key);
			
			// register all Mediators
			facade.registerMediator(new MainMediator(view.mainScreen));
		}
		
		override public function listNotificationInterests() : Array
		{
			return [
				ApplicationFacade.MAIN_SCREEN_SHOW
				];
		}
		override public function handleNotification(notification : INotification) : void
		{
			switch(notification.getName())
			{
				case ApplicationFacade.MAIN_SCREEN_SHOW:
					view.addObj(Application.NAME_MAIN_SCREEN);
					break;
			}
		}
		
		
		
		
		
		
		public function get view() : Application
		{
			return viewComponent as Application;
		}
	}
}
